/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package cpasl;

import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Pos;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.RadioButton;
import javafx.scene.control.TextField;
import javafx.scene.control.ToggleGroup;
import javafx.scene.layout.GridPane;

/**
 *
 * @author seanm_000
 */
public class HandGridPane extends GridPane {
    
    public HandGridPane() {
        
        setAlignment(Pos.CENTER);
        setHgap(15);
        setVgap(15);
        
        Label handLabel = new Label("Which is your dominant hand?");
        final ToggleGroup handGroup = new ToggleGroup();
        RadioButton leftButton = new RadioButton("Left ");
        leftButton.setUserData("A");
        leftButton.setToggleGroup(handGroup);
        leftButton.setSelected(true);
        RadioButton rightButton = new RadioButton("Right");
        rightButton.setUserData("B");
        rightButton.setToggleGroup(handGroup);
        RadioButton bothButton = new RadioButton("Both / Ambidextrous");
        bothButton.setUserData("C");
        bothButton.setToggleGroup(handGroup);
        
        Button nextButton = new Button();
        nextButton.setText("Next");
        nextButton.setId("next-button");
        nextButton.setOnAction(new EventHandler<ActionEvent>() {

            @Override
            public void handle(ActionEvent event) {
                String userData = (String) ((RadioButton) handGroup.getSelectedToggle()).getUserData();
                CpaslManager.getInstance().setDominantHand(userData);
               CpaslManager.getInstance().switchToDisplay(Groups.HEARING, 0);
            }
        });
        
        add(handLabel, 0, 0);
        add(leftButton, 0, 1);
        add(rightButton, 0, 2);
        add(bothButton, 0, 3);
        add(nextButton, 0, 4);
    }
    
}
